const R = require("../lib/rands")
const L = require('../lib/lists')
const core = require('../lib/core')


describe("Test rands.js::", () => {

  describe("get_one ", () => {
    it("Get one should be contained in the list", () => {
      const my_list = [1, 3, 9, 11, 99]
      core.repeat_call(() => {
        expect(L.is_in(my_list, R.get_one(my_list))).toBe(true)
      }, 4)
    })
  })

  describe("get_diff_element ", () => {
    it("Result should not contain in current list", () => {
      const originList = [1, 2, 5, 6, 7, 8]
      const curList = [1, 5, 6]
      core.repeat_call(() => {
        expect(L.is_not_in(curList, R.get_diff_element(originList, curList))).toBe(true)
      }, 4)
    })
  })

  describe("get_no_repeat_list ", () => {
    it("Result should not has duplicate element", () => {
      const originList = [1, 2, 5, 6, 7, 8]
      core.repeat_call(() => {
        // console.log(core.get_no_repeat_list(originList,4))
        expect(!L.has_duplicate(R.get_no_repeat_list(originList, 4))).toBe(true)
      }, 3)
    })
  })

})